<template>
  <div class="home" ref="AICore">
    <el-container>
      <el-main>
        <el-tabs type="border-card">
          <el-tab-pane>
            <span slot="label"><i class="el-icon-data-analysis"></i>模型训练</span>
            <el-row>
              <el-row>
                <el-col :span="24" style=" text-align: left">
                  <span style="font-size: 20px;  font-weight: bold;">训练模型</span>
                </el-col>
              </el-row>
              <el-steps :active="active" align-center>
                <el-step title="上传数据" description="成功了！"></el-step>
                <el-step title="参数设置" description="我超棒！"></el-step>
                <el-step title="模型训练" description="我是神仙！"></el-step>
                <el-step title="训练结果" description="我怎么这么厉害！NB"></el-step>
              </el-steps>
              <el-button style="margin-top: 12px;" @click="next">执行</el-button>
            </el-row>
            <el-divider></el-divider>
            <el-row>
              <el-col :span="10" style="border-right: 1px solid #d5d5d5;">
                <p style="text-align: center; margin: 0 0 20px">请上传分析数据</p>
                <el-upload
                    class="upload-data"
                    drag
                    action="https://jsonplaceholder.typicode.com/posts/"
                    multiple>
                  <i class="el-icon-upload"></i>
                  <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
                </el-upload>
                <el-button style="margin-top: 12px;" @click="analysis" type="primary">解析数据</el-button>
              </el-col>
<!--              <el-col :span="1">|</el-col>-->
              <el-col :span="14">
                <p style="text-align: center; margin: 0 0 20px">指定模型输入输出</p>
                <div style="text-align: center">
                  <el-transfer
                      style="text-align: left; display: inline-block"
                      v-model="value"
                      filterable
                      :left-default-checked="[2, 3]"
                      :right-default-checked="[1]"
                      :render-content="renderFunc"
                      :titles="['输入特征', '预测标签']"
                      :button-texts="['到左边', '到右边']"
                      :format="{
                      noChecked: '${total}',
                      hasChecked: '${checked}/${total}'
                      }"
                      @change="handleChange"
                      :data="data">
                    <!--                <el-button class="transfer-footer" slot="left-footer" size="small">操作</el-button>-->
                    <el-button class="transfer-footer" slot="right-footer" size="small" type="primary">训练模型
                    </el-button>
                  </el-transfer>
                </div>
              </el-col>
            </el-row>
            <el-divider></el-divider>
            <el-row>
              <el-col :span="12" style="margin-top: 40px;">
                <el-image src="/model.gif"></el-image>
              </el-col>
              <el-col :span="12" style="margin-top: 40px; text-align: left">
                <span style="font-size: 20px;  font-weight: bold;">训练日志</span>
                <el-collapse v-model="activeNames" @change="handleChange">
                  <el-collapse-item title="一致性 Consistency" name="1">
                    <div>与现实生活一致：与现实生活的流程、逻辑保持一致，遵循用户习惯的语言和概念；</div>
                    <div>在界面中一致：所有的元素和结构需保持一致，比如：设计样式、图标和文本、元素的位置等。</div>
                  </el-collapse-item>
                  <el-collapse-item title="反馈 Feedback" name="2">
                    <div>控制反馈：通过界面样式和交互动效让用户可以清晰的感知自己的操作；</div>
                    <div>页面反馈：操作后，通过页面元素的变化清晰地展现当前状态。</div>
                  </el-collapse-item>
                  <el-collapse-item title="效率 Efficiency" name="3">
                    <div>简化流程：设计简洁直观的操作流程；</div>
                    <div>清晰明确：语言表达清晰且表意明确，让用户快速理解进而作出决策；</div>
                    <div>帮助用户识别：界面简单直白，让用户快速识别而非回忆，减少用户记忆负担。</div>
                  </el-collapse-item>
                  <el-collapse-item title="可控 Controllability" name="4">
                    <div>用户决策：根据场景可给予用户操作建议或安全提示，但不能代替用户进行决策；</div>
                    <div>结果可控：用户可以自由的进行操作，包括撤销、回退和终止当前操作等。</div>
                  </el-collapse-item>
                </el-collapse>
              </el-col>
            </el-row>
          </el-tab-pane>
          <el-tab-pane>
            <span slot="label"><i class="el-icon-data-line"></i>智能预测</span>
          </el-tab-pane>
        </el-tabs>
      </el-main>
    </el-container>
  </div>
</template>

<script>

export default {
  data() {
    function generateData() {
      const data = [];
      for (let i = 1; i <= 15; i++) {
        data.push({
          key: i,
          label: `备选项 ${i}`,
          disabled: i % 4 === 0
        });
      }
      return data;
    }
    return {
      activeNames: 1,
      active: 0,
      data: generateData(),
      value: [1],
      renderFunc(h, option) {
        return <span>{option.key} - {option.label}</span>;
      }
    };
  },

  methods: {
    handleChange(value, direction, movedKeys) {
      console.log(value, direction, movedKeys);
    },
    next() {
      if (this.active++ > 3) this.active = 0;
    }
  }
};
</script>

<style scoped lang="scss">
.transfer-footer {
  margin-left: 20px;
  padding: 6px 5px;
}

.el-main {
  background-color: #E9EEF3;
  color: #333;
  text-align: center;
  //line-height: 160px;
}

::v-deep .el-upload-dragger {
  height: 250px;
  display: grid;
  place-items: center; /* 同时实现横向和纵向居中 */
}
</style>